//
// Created by hsj on 2022/1/14.
//

#include <iostream>
#include "t_class_cast.h"
namespace my_class_cast {
//    测试类的转换（强转、自动转）
    void test_class_cast() {
        using std::cout;
        using std::endl;

        //必须显示转换
        Stonewt s = (Stonewt)18.0;
        s.showLbs();
        s.showStn();

        Stonewt s002(28.0);
        Stonewt s003 = Stonewt(8.0);
        s002.showLbs();
        s002.showStn();
        s003.showLbs();
        s003.showStn();

        //必须显示转换
        int s002_int = int (s002);
        double s003_double = (double)s003;
        cout<<s002_int<<endl;
        cout<<s003_double<<endl;
    }
}